/**

 */
package com.adkfp.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.adkfp.bean.ADKManageRoleBean;
import com.adkfp.dao.ADKManageRoleDaoMapper;
import com.adkfp.service.IADKManageRoleService;

/**
 * class name:SelectclassAction <BR>
 * class description: please write your description <BR>
 * Remark: <BR>
 * @version 1.00 2019年1月25日
 * @author ADK)zhoulin
 */
@Service("aDKManageRoleService")
public class ADKManageRoleServiceImpl implements IADKManageRoleService{

	@Resource
	private ADKManageRoleDaoMapper aDKmanageRoleDaoMapper;

	@Override
	@Transactional
	public void insert(ADKManageRoleBean bean) {
		aDKmanageRoleDaoMapper.insert(bean);
	}

	@Override
	@Transactional
	public void delete(Integer id) {
		aDKmanageRoleDaoMapper.delete(id);		
	}

	@Override
	@Transactional
	public void update(ADKManageRoleBean bean) {
		aDKmanageRoleDaoMapper.update(bean);		
	}

	@Override
	@Transactional
	public List<ADKManageRoleBean> findByCondition(ADKManageRoleBean bean) {
		return aDKmanageRoleDaoMapper.findByCondition(bean);
	}

	@Override
	@Transactional
	public long findByConditionCount(ADKManageRoleBean bean) {
		return aDKmanageRoleDaoMapper.findByConditionCount(bean);
	}

	@Override
	public ADKManageRoleBean findById(Integer id) {
		return aDKmanageRoleDaoMapper.findById(id);
	}

	@Override
	public List<ADKManageRoleBean> getManageRoleByMap(Map<String, String> map) {
		return aDKmanageRoleDaoMapper.getManageRoleByMap(map);
	}
	
	/**
	 * 删除角色
	 */
	public void delManageRoleById(long id){
		try {
			Map<String, String> map = new HashMap<String, String>();
			map.put("id", id+"");
			map.put("deleteFlag", "1");
			aDKmanageRoleDaoMapper.updateManageRoleById(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * 修改角色
	 */
	public void updateManageRoleById(long id, String name){
		try {
			Map<String, String> map = new HashMap<String, String>();
			map.put("id", id+"");
			map.put("name", name);
			aDKmanageRoleDaoMapper.updateManageRoleById(map);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
